Change the command to raise when adding new project from existing code#396
Change the command to raise when adding new project from existing code#396mousetraps merged 9 commits intomicrosoft:masterfrom zhengbli:issue133
Conversation
|
👍 |
|
Thanks for figuring this out! Now you are calling AddProject instead of OpenProject, I can see how this fixes the issue referenced. Did you also check that running the "Import from existing code" scenario with no existing project/sln open still continues to work also? |
|
Right, after some tests it didn't work for the no-existing project/sln scenario. I need to fix that. |
|
@billti Added code to detect the availability of the "Add Existing Project", now it works as expected in both cases. |
There was a problem hiding this comment.
Does this work in the instance where a project is open (so the AddExistingProject command is available), but someone is nonetheless creating a new project?
Perhaps a better solution is to intercept the command in the NodejsPackage.Initialize() step by handling BeforeExecute and AfterExecute events (set a boolean flag that we check in ImportWizardCommand).
E.g. http://stackoverflow.com/questions/15406523/visual-studio-extensibility-intercepting-file-paste-event
There was a problem hiding this comment.
Alternatively, just pass in the cmdIdToRaise rather than effectively checking it twice.
Then, you can can simplify all this to:
NodejsPackage.Instance.DTE.Commands.Raise(
VSConstants.GUID_VSStandardCommandSet97.ToString("B"), cmdIdToRaise, ref pathRef, ref outRef);|
Overall implementation looks good now - left several minor comments and lgtm after that. |
|
@mousetraps can you take a look at my updates? Thanks! |
|
👍 |
Fix #133 - Change the command to raise when adding new project from existing code
This PR fixes #133.
Previously the raised command when adding new project from existing code is
VSConstants.VSStd97CmdID.OpenProject, which actually corresponds to theOpen Projectmenu item, that will always create a new solution. Changing it toVSConstants.VSStd97CmdID.AddExistingProjectfixed the problem.